#include "SetStatusTask.h"
#include "../../../core/Impp.h"

namespace Impp
{

SetStatusTask::SetStatusTask(const ActionId & id, const qword & requestId, const Status & status, Oscar* oscar) :
	Task(TASK_AVATAR_REQUEST, oscar, TASK_HANDLE_REQUESTID, requestId, (time_t)20),
	actionId(id),
	status(status),
	isPackageSent(false)
{
}

SetStatusTask::~SetStatusTask()
{
}

ActionId SetStatusTask::getActionId()
{
	return actionId;
}

bool SetStatusTask::checkForTimeOut(const time_t & now){
	if(isPackageSent){
		return true;
	}
	return Task::checkForTimeOut(now);
}

void SetStatusTask::timedOut(){
	if(!isPackageSent){
		wxLogTrace(wxT("STATUS"), wxT("SetStatusTask::timedOut: Task timed out"));
	}
}

void SetStatusTask::packageSent(){
	isPackageSent=true;
	Impp::exemplar()->processOwnStatusChanged(oscar->getAccount()->id, actionId, status);
}

}
